package com;

import com.model.AcmeProperties;
import com.model.Teacher;
import com.model.ValueProperties;
import com.model.YamlModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableConfigurationProperties(AcmeProperties.class)
public class HelloSpringBoot {

    @RequestMapping("hello")
    public String hello() {
        return "Hello SpringBoot!";
    }

    @Autowired
    private YamlModel yamlModel;

    @RequestMapping("yaml")
    public String yaml() {
        System.out.println(yamlModel.toString());
        return "Hello Ymal!";
    }

    @Autowired
    private Teacher teacher;

    @RequestMapping("teach")
    public String teach() {
        System.out.println(teacher.toString());
        return "Hello Teacher!";
    }

    @Autowired
    private AcmeProperties acmeProperties;

    @RequestMapping("acme")
    public String acme() {
        System.out.println(acmeProperties.toString());
        return "Hello acme!";
    }

    @Autowired
    private ValueProperties valueProperties;

    @RequestMapping("value")
    public String value() {
        System.out.println(valueProperties.toString());
        return "Hello acme!";
    }


}
